//引入二次封装的axios
import request from "@/utils/request";
//引入类型
import type { reqSkuDataList, reqOneSku } from "./type";
//枚举地址
enum API {
  //获取sku信息
  GETSKULIST_URL = "/admin/product/list/",
  //上架商品
  ONSALE_URL = "/admin/product/onSale/",
  //下架商品
  CANCELSALE_URL = "/admin/product/cancelSale/",
  //获取单个sku详细信息
  GETONESKU_URL = "/admin/product/getSkuInfo/",
  //删除sku
  DELETE_URL = "/admin/product/deleteSku/",
}
//获取sku接口
export const reqSkuList = (page: number, limit: number) =>
  request.get<any, reqSkuDataList>(API.GETSKULIST_URL + `${page}/${limit}`);
//上架商品接口
export const reqOnSale = (skuId: number) =>
  request.get<any, any>(API.ONSALE_URL + skuId);
//下架商品
export const reqCancelSale = (skuId: number) =>
  request.get<any, any>(API.CANCELSALE_URL + skuId);
//获取单个sku详细信息
export const reqGetOneSku = (skuId: number) =>
  request.get<any, reqOneSku>(API.GETONESKU_URL + skuId);
//删除sku
export const reqDeleteSku = (skuId: number) =>
  request.delete<any, any>(API.DELETE_URL + skuId);
